package germmy.groovy;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import hello.RuleEngine;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:conf/applicationContext.xml")
public class GermmyDemo {
 
	@Autowired
	RuleEngine ruleEngine = null ;
	
    @Test
    public void run() {
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                    System.in));
            while (true) {
            	System.out.println("请输入ruleName:");
                // 循环获取输入，每次有输入即进行一次调用
                String ruleName = reader.readLine();
                if ("exit".equals(ruleName)) {
                    break;
                }
                System.out.println("请输入paramName:");
                String paramName = reader.readLine();
                if ("exit".equals(paramName)) {
                	break;
                }
                ruleEngine.run(ruleName,paramName);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}